﻿namespace KingerRobot.MexicoSailunWMS.SpiService;

internal interface IWmsOutOrderSummary
{
    /// <summary>
    /// 安全限号
    /// </summary>
    /// <param name="id"></param>
    /// <param name="safe"></param>
    /// <returns></returns>
    int UpdateSummarySafe(long? id, int safe);
    /// <summary>
    /// 重新请料从表
    /// </summary>
    /// <param name="summaryId"></param>
    /// <returns></returns>
    int ReRequestSummary(long summaryId);
    /// <summary>
    /// 通过堆垛机id获取出库订单详情
    /// </summary>
    /// <param name="CrnId"></param>
    /// <returns></returns>
    List<POWmsOutOrderSummary> GetOutOrderSummaryByCrnId(long CrnId, ref List<POWcsTask> Task);
    /// <summary>
    /// 获取出库订单是否还有明细数据
    /// </summary>
    /// <param name="masterId"></param>
    /// <returns></returns>
    bool IsOutOrderSummaryByMasterId(long masterId);
    /// <summary>
    /// 备份并删除订单信息
    /// </summary>
    /// <param name="masterId"></param>
    /// <returns></returns>
    int BakAndDeleteOutOrderSummary(long id);
    /// <summary>
    /// 获取出库单信息
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    POWmsOutOrderSummary GetOutOrderSummaryById(long id);
    /// <summary>
    /// 通过货位ID获取订单信息
    /// </summary>
    /// <param name="locId"></param>
    /// <returns></returns>
    POWmsOutOrderSummary GetOutOrderSummaryByLocId(long locId);
    /// <summary>
    /// 修改完成方式
    /// </summary>
    /// <param name="masterId"></param>
    /// <returns></returns>
    int UpdateOutOrderSummaryFinish(long masterId, int finishMode);
    /// <summary>
    /// 获取所有出库订单
    /// </summary>
    /// <returns></returns>
    List<POWmsOutOrderSummary> GetOrderSummaryList();
    /// <summary>
    /// 获取出库单信息
    /// </summary>
    /// <param name="type">类型</param>
    /// <param name="status">状态</param>
    /// <returns></returns>
    List<POWmsOutOrderSummary> GetOutOrderSummaryList(int type, int status);
    /// <summary>
    /// 添加订单
    /// </summary>
    /// <param name="WmsOutOrderSummaries"></param>
    /// <returns></returns>
    int AddOutOrderSummaryListByLoc(List<POWmsOutOrderSummary> WmsOutOrderSummaries);
    /// <summary>
    /// 未创建请料任务的出库订单(所有类型【硫化请料、普通出库、库位出库】)
    /// </summary>
    /// <returns></returns>
    List<POWmsOutOrderSummary> GetOutOrderSummaryNoTaskList(int type);
    /// <summary>
    /// 获取订单执行进度
    /// </summary>
    /// <param name="summaryId"></param>
    /// <returns></returns>
    OutOrderSummaryKanBan GetOutOrderSummarySchedule(POWmsOutOrderSummary summary);


}


public class OrderSummaryGroupyMaster
{
    /// <summary>
    /// 订单主ID
    /// </summary>
    public long MasterId { get; set; }
    /// <summary>
    /// 订单明细数量
    /// </summary>
    public int Count { get; set; }
    /// <summary>
    /// 订单类型
    /// </summary>
    public int OrderType { get; set; }
    /// <summary>
    /// 订单信息
    /// </summary>
    public List<POWmsOutOrderSummary> POWmsOutOrderSummaries { get; set; }
}

public class OutOrderSummary
{
    /// <summary>
    /// 中间表ID
    /// </summary>
    public string MidId { get; set; }
    /// <summary>
    /// 订单主ID
    /// </summary>
    public long MasterId { get; set; }
    /// <summary>
    /// 顺序号
    /// </summary>
    public int SummaryIndex { get; set; }
    /// <summary>
    /// 旋转角度
    /// </summary>
    public decimal RotateAngle { get; set; }
    /// <summary>
    /// 目标硫化位
    /// </summary>
    public long TargetLoc { get; set; }
    public string Spec { get; set; }
    /// <summary>
    /// 产品编码
    /// </summary>
    public string MaterialCode { get; set; }
    /// <summary>
    /// 此处批次号 = 产品批次号
    /// </summary>
    public string SkuBatch { get; set; }
    /// <summary>
    /// 是否可以请料（true:可以；false:不可以）
    /// </summary>
    public bool IsCall { get; set; }
}